<%@ page import=" java.util.Date, 
			java.sql.Connection, java.sql.PreparedStatement,
 			java.sql.ResultSet, java.text.SimpleDateFormat, 
 			java.util.TimeZone;" language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<jsp:useBean id="member" class="com.kamikaze.Member" scope="session" />
<jsp:useBean id="overtime" class="com.kamikaze.Overtime" scope="session" />
<%
java.util.Date now = new java.util.Date(); //取得現在時間
SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd");
String day = dd.format(now);

for (String msg : overtime.getErrors()) {
	%><%=msg %><%
}
%>

<sql:query var="rs" dataSource="jdbc/j2db" >
SELECT od.otd_number, s.shift_number, us.user_id, us.user_name, 
od.otd_date, od.otd_time_begin, od.otd_time_end, od.approved, od.checker_id, 
od.otd_note, ot.ot_name,otd_time
FROM shift s, overtimedata od, users us, overtimes ot
WHERE s.user_id = us.user_id
AND s.shift_number = od.shift_number
AND od.ot_number = ot.ot_number

</sql:query>
<table border=1>
<caption><h1>加班核准與修改</h1></caption>
<hr>
				<tr>
					<th>加班編號</th>
					<th>班表編號</th>
					<th>員工編號</th>
					<th>員工姓名</th>
					<th>加班日期</th>
					<th>起始時間</th>
					<th>結束時間</th>
					<th>加班別</th>
					<th>申請時間</th>
					<th>核可</th>
					<th>核可主管</th>
					<th>備註</th>
					<th>執行</th>
				</tr>
<c:forEach var="r" items="${rs.rows}">

					<tr>
						<td>${r.otd_number }</td>
						<td>${r.shift_number }</td>
						<td>${r.user_id }</td>
						<td>${r.user_name }</td>
						<td>${r.otd_date }</td>
						<td>${r.otd_time_begin }</td>
						<td>${r.otd_time_end }</td>
						<td>${r.ot_name }</td>
						<td>${r.otd_time }</td>
						<td>${r.approved }</td>
						<td>${r.checker_id }</td>
						<td>${r.otd_note }</td>
						<td><A href="overtimecheck.jsp?id=${r.otd_number }"><c:out value="核准" /></A>
						<A href="overtime_check_no.jsp?id=${r.otd_number }"><c:out value="不准" /></A>
						<A href="index.jsp?f=16&id=${r.otd_number }"><c:out value="修改" /></A></td>
					</tr>


</c:forEach>
</table>